# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-mini_mime
_gemname=${pkgname#ruby-}
pkgver=1.1.5
pkgrel=0
pkgdesc="minimal mime type library"
url="https://rubygems.org/gems/mini_mime"
arch="noarch"
license="MIT"
checkdepends="ruby-rake ruby-bundler ruby-minitest"
depends="ruby"
source="$pkgname-$pkgver.tar.gz::https://github.com/discourse/mini_mime/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
options="!check" #checks depend on rubocop, which is not currently packaged.

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc
}

sha512sums="
38da060c723ca21dfda783629ff065dfcc3634e7c0117f8f4af8e38abc1822656a5a62fabe154bed75cfc56637cfa65c596d354cfcdb673f98bce0653b47a816  ruby-mini_mime-1.1.5.tar.gz
19a39b01a125698927545c8cdd1fbc36b446febb10dc721086b9a49b2c3f8c2c825759bdc1104caa35dc7b648c621bc44a6bb854fa6a0be8661c3283d1010529  gemspec.patch
"
